﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls;
using TracNghiemTinHocDaiCuong.BIZ;
using TracNghiemTinHocDaiCuong.Common;

namespace TracNghiemTinHocDaiCuong
{
    public partial class QuanLyBaiHoc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LayDanhSach();
        }

        protected void btnThemBaiHoc_Click(object sender, EventArgs e)
        {
            Response.Redirect("ThemBaiHoc.aspx");
        }

        protected void btnSuaBaiHoc_Click(object sender, EventArgs e)
        {
            Response.Redirect(string.Format("SuaBaiHoc.aspx?ID={0}", ViewState["idBaiHoc"]));
        }

        protected void btnXoaBaiHoc_Click(object sender, EventArgs e)
        {
            BaiHocBIZ.Xoa(Methods.ConvertNumber(ViewState["idBaiHoc"].ToString()));
            LayDanhSach();
        }

        protected void lkbtnBaiHoc_Click(object sender, CommandEventArgs e)
        {
            ViewState["idBaiHoc"] = Methods.ConvertNumber(e.CommandName);
            //gvBaiHoc.SelectedRow.ID = 
        }

        private void LayDanhSach()
        {
            gvBaiHoc.DataSource = BaiHocBIZ.LayDanhSach();
            gvBaiHoc.DataBind();
        }
    }
}